package com.wonders.frame.entity;


import com.wonders.frame.core.entity.EntityTemplate;
import lombok.Data;

import javax.persistence.*;
import java.util.List;

@Entity
@Data

@Table(name = "auth_dic")
public class AuthDic extends EntityTemplate {

    @Transient
    @ManyToOne(cascade={CascadeType.REFRESH})
    @JoinColumn(name="dic_parent_id")
    private AuthDic parent;


    @Column(name = "code")
    private String code;                 //'代码'(字典值),

    @Column(name = "description")
    private String description ;         //'描述',

    @Column(name = "displaytype")
    private String displaytype;          //'展示类型(普通0，树1)',

    @Column(name = "simplename")
    private String simplename;        //'简称',

    @Column(name = "seq")
    private Integer seq;                  //'序号',

    @Column(name = "parent_id")
    private String parentId;           //'父节点',关联字典类型表的code

    @Column(name = "dic_parent_id")
    private String dicParentId;           //'父节点',关联字典类型表的code

    @Column(name = "name")
    private String name;                 //'名称', 即字典对应值。

    @Column(name = "dic_type")
    private String  dicType;             //'关联字典类型表的code',

    @Column(name = "trans_val")
    private String transVal ;           //'对照值',

    @OneToMany(cascade={CascadeType.REFRESH, CascadeType.REMOVE}, fetch = FetchType.EAGER)
    @JoinColumn(name = "dic_parent_id")
    private List<AuthDic> authDicChildren;



}
